package com.fancymusic.service.impl;

import com.fancymusic.dao.IAlbumDao;
import com.fancymusic.entity.Album;
import com.fancymusic.service.IAlbumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
//@Transactional
public class AlbumServiceImpl implements IAlbumService {
    @Autowired
    IAlbumDao iAlbumDao;




    @Override
    @Transactional(propagation= Propagation.SUPPORTS)
    public List<Album> findAlbumByName(Album album) {
        List<Album> albumByName = iAlbumDao.findAlbumByName(album.getAlbumName());

        return albumByName;
    }

    @Override
    public void saveAlbum(Album album) {
        iAlbumDao.saveAlbum(album);
    }

    @Override
    public List<Album> findAlbume() {
        return iAlbumDao.findAlbume();
    }
}
